#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>


class Mythread 
{
    public:
        Mythread()
        {
            pno = 1;
        }
        ~Mythread()
        {

        }
        int  pthread_create_()
        {
            int ret = pthread_create(&pt,NULL,pthread_start_,(void*)this);
            if(ret < 0)
            {
                return -1;

            }
            while(1)
            {
                 printf("main pthread\n");
                 sleep(1);
            }
        }
        static void* pthread_start_(void* arg)
        {
           Mythread* i = (Mythread*)arg; 
           while(1)
           {
                printf("pno:%d\n",i->pno);
                sleep(1);
           }
        }
    private:
        int pno;
        pthread_t pt;
};

int main()
{
    Mythread* p = new Mythread();
    p->pthread_create_();
    return 0;
}
